<div class="user-quick-detail">
    <div class="uqd-avatar">
        <?php
        /**
         * @var user Customer at tbl_customer
         */
        ?>
        <img width="70px"
             src="<?php echo $user->getAvartBySize(70, 70); ?>" alt="<?php echo htmlentities($user->name, ENT_QUOTES) ?>"/>
    </div>
    <div class="uqd-info">
        <strong><?php echo htmlentities($user->name, ENT_QUOTES) ?></strong>

        <?php if ($user->birthday): ?>            
            <br/>
            <span class="text-small">
                <?php echo date('d/M/Y', $user->birthday) ?>
            </span>
        <?php endif; ?>

        <?php if ($user->email): ?>
            <br/>
            <span class="text-small"><?php echo $user->email ?></span>        
        <?php endif; ?>

        <?php if ($user->phone): ?>            
            <br/>
            <span class="text-small"><?php echo $user->phone ?></span>
        <?php endif; ?>

        <?php if ($user->address): ?>            
            <br/>
            <span class="text-small"><?php // echo @$user->fullAddress   ?></span>
        <?php endif; ?>
        <span class="text-small"><a target="_blank" href="<?php echo $user->editUrl ?>"><u>More details</u></a></span>

    </div>
    <div class="clearfix"></div>
    <?php if ($type != Users::TYPE_CUSTOMER): ?> 
        <?php if ($user->type == Users::TYPE_STAFF): ?>
            <div class="row-fluid text-small">
                <div class="span6">
                    <i class="icon-arrow-left"></i> <b>Prev Appointment</b>
                    <?php if (Appoint::getPrevAppt($user->ukey) != FALSE): ?>
                        <?php
                        $max_appt  = Appoint::getPrevAppt($user->ukey);
                        $appt_prev = Appoint::model()->findByPk($max_appt['id']);
                        ?>
                        <?php if ($appt_prev != null): ?>
                            <table class="table tablel-bordered table-striped">
                                <tbody>
                                    <tr>
                                        <td>
                                            <b>Service/Room:</b> <?php echo htmlentities($appt_prev->service->s_name, ENT_QUOTES); ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <b>From:</b> <?php echo $appt_prev->start_time; ?> to <?php echo $appt_prev->end_time; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <b>At:</b> <?php echo date('d/M/Y', $appt_prev->date); ?>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        <?php endif; ?>
                    <?php else: ?>
                        <div class="alert alert-error">
                            No Appointment found.
                        </div>
                    <?php endif; ?>
                </div>
                <div class="span6">
                    <b>Next Appointment</b> <i class="icon-arrow-right"></i>
                    <?php if (Appoint::getNextAppt($user->ukey) != FALSE): ?>
                        <?php
                        $min_appt  = Appoint::getNextAppt($user->ukey);
                        $appt_next = Appoint::model()->findByPk($min_appt['id']);
                        ?>
                        <?php if ($appt_next != null): ?>
                            <table class="table table-bordered table-striped">
                                <tbody>
                                    <tr>
                                        <td>
                                            <b>Service/Room:</b>  <?php echo htmlentities($appt_next->service->s_name, ENT_QUOTES); ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <b>From:</b> <?php echo $appt_next->start_time; ?> to <?php echo $appt_next->end_time; ?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <b>At:</b> <?php echo date('d/M/Y', $appt_next->date); ?>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        <?php endif; ?>
                    <?php else: ?>
                        <div class="alert alert-error">
                            No Appointment found.
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        <?php endif; ?>
    <?php else: ?>
        <div class="row-fluid text-small">
            <div class="span6">
                <i class="icon-arrow-left"></i> <b>Prev Appointment</b>
                <?php
                $max_appt = AptCustomer::getPrevAppt($user->ckey);
                ?>
                <?php if ($max_appt != FALSE): ?>
                    <?php
                    $appt_prev = Appoint::model()->findByPk($max_appt['id']);
                    ?>
                    <?php if ($appt_prev != null): ?>
                        <table class="table table-bordered table-striped">
                            <tbody>
                                <tr>
                                    <td>
                                        <b>Service/Room:</b> <?php echo htmlentities($appt_prev->service->s_name, ENT_QUOTES); ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <b>From:</b> <?php echo $appt_prev->start_time; ?> to <?php echo $appt_prev->end_time; ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <b>At:</b> <?php echo date('d/M/Y', $appt_prev->date); ?>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    <?php endif; ?>
                <?php else: ?>
                    <div class="alert alert-error">
                        No Appointment found.
                    </div>
                <?php endif; ?>
            </div>
            <div class="span6">
                <b>Next Appointment</b> <i class="icon-arrow-right"></i>
                <?php if (AptCustomer::getNextAppt($user->ckey) != FALSE): ?>
                    <?php
                    $min_appt  = AptCustomer::getNextAppt($user->ckey);
                    $appt_next = Appoint::model()->findByPk($min_appt['id']);
                    ?>
                    <?php if ($appt_next != null): ?>
                        <table class="table table-bordered table-striped">
                            <tbody>
                                <tr>
                                    <td>
                                        <b>Service/Room:</b>  <?php echo htmlentities($appt_next->service->s_name, ENT_QUOTES); ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <b>From:</b> <?php echo $appt_next->start_time; ?> to <?php echo $appt_next->end_time; ?>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <b>At:</b> <?php echo date('d/M/Y', $appt_next->date); ?>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    <?php endif; ?>
                <?php else: ?>
                    <div class="alert alert-error">
                        No Appointment found.
                    </div>
                <?php endif; ?>
            </div>
        </div>
    <?php endif; ?>
</div>